```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java参数传递机制深度解析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .hero {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
            color: white;
        }
        .code-block {
            background-color: #282c34;
            border-radius: 8px;
            color: #abb2bf;
            position: relative;
        }
        .code-header {
            background-color: #1e2227;
            border-top-left-radius: 8px;
            border-top-right-radius: 8px;
            padding: 8px 12px;
            color: #ccc;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
        }
        .code-body {
            padding: 16px;
            overflow-x: auto;
        }
        .section-title {
            position: relative;
            padding-left: 24px;
        }
        .section-title:before {
            content: "";
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            height: 24px;
            width: 6px;
            background: linear-gradient(to bottom, #6e8efb, #a777e3);
            border-radius: 3px;
        }
        .feature-card {
            transition: all 0.3s ease;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        }
        .footer {
            background-color: #1a1a1a;
            color: #e5e5e5;
        }
        .footer a:hover {
            color: #6e8efb;
        }
        .mermaid {
            background-color: #f8f9fa;
            border-radius: 12px;
            padding: 20px;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col items-center text-center">
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full text-sm font-medium mb-4">编程基础</span>
                <h1 class="text-4xl md:text-5xl font-bold mb-6 text-white">Java参数传递机制深度解析</h1>
                <p class="text-xl md:text-2xl font-light max-w-3xl leading-relaxed opacity-90">
                    揭秘值传递与引用传递的本质区别，掌握Java内存模型的底层原理
                </p>
                <div class="mt-8 flex space-x-4">
                    <a href="#value-pass" class="px-6 py-3 bg-white text-indigo-600 font-medium rounded-full hover:bg-opacity-90 transition-all">
                        <i class="fas fa-arrow-down mr-2"></i>值传递
                    </a>
                    <a href="#reference-pass" class="px-6 py-3 bg-white bg-opacity-20 text-white font-medium rounded-full hover:bg-opacity-30 transition-all">
                        <i class="fas fa-project-diagram mr-2"></i>引用传递
                    </a>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 py-12">
        <!-- Introduction -->
        <section class="mb-16">
            <p class="text-lg text-gray-700 leading-relaxed mb-8">
                在Java中，方法参数的传递方式有两个主要概念：值传递（Pass by Value）和引用传递（Pass by Reference）。尽管有时人们对这两个概念产生混淆，但理解它们的不同点对编程实践至关重要。
            </p>
            <div class="grid md:grid-cols-2 gap-8">
                <div class="feature-card bg-white p-8">
                    <div class="text-indigo-500 text-3xl mb-4">
                        <i class="fas fa-copy"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">值传递的本质</h3>
                    <p class="text-gray-600">在Java中，所有方法参数都是通过值传递的。即使传递的是对象的引用，实际上传递的是引用的副本。</p>
                </div>
                <div class="feature-card bg-white p-8">
                    <div class="text-indigo-500 text-3xl mb-4">
                        <i class="fas fa-link"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">引用传递的误解</h3>
                    <p class="text-gray-600">Java并不支持真正的引用传递，所有的对象传递都是值传递。理解这一区别对编写正确代码至关重要。</p>
                </div>
            </div>
        </section>

        <!-- Value Passing Section -->
        <section id="value-pass" class="mb-16">
            <div class="flex items-center mb-8">
                <span class="text-4xl text-indigo-500 font-bold mr-4">01</span>
                <h2 class="section-title text-3xl font-bold text-gray-800">值传递（Pass by Value）</h2>
            </div>
            
            <div class="mb-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800">定义</h3>
                <p class="text-gray-700 mb-6">在Java中，所有方法参数都是通过值传递的。即使传递的是对象的引用，实际上传递的是引用的副本。</p>
                
                <h3 class="text-xl font-semibold mb-4 text-gray-800">特点</h3>
                <ul class="space-y-3 mb-6">
                    <li class="flex items-start">
                        <span class="text-indigo-500 mr-2 mt-1"><i class="fas fa-check-circle"></i></span>
                        <span>当一个基本类型（如<code class="bg-gray-100 px-1 py-0.5 rounded">int</code>、<code class="bg-gray-100 px-1 py-0.5 rounded">char</code>、<code class="bg-gray-100 px-1 py-0.5 rounded">boolean</code>等）作为参数传递时，方法接收到的是该值的一个拷贝。对这个拷贝的修改不会影响原始值。</span>
                    </li>
                    <li class="flex items-start">
                        <span class="text-indigo-500 mr-2 mt-1"><i class="fas fa-check-circle"></i></span>
                        <span>当一个对象作为参数传递时，方法接收到的是该对象引用的一个拷贝。此时，虽然你可以通过这个引用访问对象并修改其内部状态，但你无法更改原始引用的指向（即不能使引用指向另一个对象）。</span>
                    </li>
                </ul>
                
                <h3 class="text-xl font-semibold mb-4 text-gray-800">示例</h3>
                <div class="code-block mb-6">
                    <div class="code-header">
                        <i class="fab fa-java mr-2"></i>Java 代码示例
                    </div>
                    <div class="code-body">
                        <pre class="overflow-x-auto"><code>public void modifyValue(int num) {
    num = 10; // 只修改了num的拷贝
}</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="bg-blue-50 border-l-4 border-blue-500 p-6 rounded-r-lg mb-8">
                <div class="flex items-start">
                    <div class="text-blue-500 mr-4 text-xl">
                        <i class="fas fa-lightbulb"></i>
                    </div>
                    <div>
                        <h4 class="font-bold text-gray-800 mb-2">关键洞察</h4>
                        <p class="text-gray-700">对于基本数据类型，方法内部对参数的修改不会影响调用方的原始变量。这是因为传递的是值的拷贝，而不是变量本身。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Reference Passing Section -->
        <section id="reference-pass" class="mb-16">
            <div class="flex items-center mb-8">
                <span class="text-4xl text-indigo-500 font-bold mr-4">02</span>
                <h2 class="section-title text-3xl font-bold text-gray-800">引用传递（Pass by Reference）</h2>
            </div>
            
            <div class="mb-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800">定义</h3>
                <p class="text-gray-700 mb-6">Java并不支持真正的引用传递，所有的对象传递都是值传递。但是，很多人将对象引用的传递方式理解为引用传递，这可能会导致一些混淆。</p>
                
                <h3 class="text-xl font-semibold mb-4 text-gray-800">特点</h3>
                <ul class="space-y-3 mb-6">
                    <li class="flex items-start">
                        <span class="text-indigo-500 mr-2 mt-1"><i class="fas fa-check-circle"></i></span>
                        <span>在Java中，当你传递一个对象时，实际上传递的是对象引用的副本。因此，可以通过这个引用修改对象的内部状态，但无法改变引用本身的指向。</span>
                    </li>
                    <li class="flex items-start">
                        <span class="text-indigo-500 mr-2 mt-1"><i class="fas fa-check-circle"></i></span>
                        <span>如果试图在方法内部改变对象的引用（使其指向另一个对象），这种改变不会反映到原始对象上。</span>
                    </li>
                </ul>
                
                <h3 class="text-xl font-semibold mb-4 text-gray-800">示例</h3>
                <div class="code-block mb-6">
                    <div class="code-header">
                        <i class="fab fa-java mr-2"></i>Java 代码示例
                    </div>
                    <div class="code-body">
                        <pre class="overflow-x-auto"><code>public void test(){
    MyObject obj1 = new MyObject();
    modifyObject(obj1); // obj1的引用被传递
    // 在modifyObject中，如果obj被重新赋值，obj1的引用不受影响
}

public void modifyObject(MyObject obj) {
    obj.setValue(10); // 修改了obj指向的对象的状态
    obj = new MyObject(); // obj的引用指向新对象，但不会影响外部的引用
}</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="bg-purple-50 border-l-4 border-purple-500 p-6 rounded-r-lg mb-8">
                <div class="flex items-start">
                    <div class="text-purple-500 mr-4 text-xl">
                        <i class="fas fa-exclamation-circle"></i>
                    </div>
                    <div>
                        <h4 class="font-bold text-gray-800 mb-2">常见误区</h4>
                        <p class="text-gray-700">许多开发者误以为Java中对象是通过引用传递的。实际上，传递的是引用的值（即引用的副本），而非引用本身。这种区别在重新分配引用时变得尤为明显。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Memory Model Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <span class="text-4xl text-indigo-500 font-bold mr-4">03</span>
                <h2 class="section-title text-3xl font-bold text-gray-800">内存模型的理解</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-8">
                <div>
                    <h3 class="text-xl font-semibold mb-4 text-gray-800">基本类型</h3>
                    <p class="text-gray-700 mb-6">在栈中存储，方法调用时传递值的拷贝。</p>
                </div>
                <div>
                    <h3 class="text-xl font-semibold mb-4 text-gray-800">对象</h3>
                    <p class="text-gray-700 mb-6">对象在堆中存储，引用（指针）存储在栈中。传递的引用是其在堆中的内存地址的拷贝。</p>
                </div>
            </div>
            
            <div class="mermaid mb-8">
                flowchart TD
                    subgraph 方法调用
                        A[调用方变量] -->|传递值| B[方法参数]
                    end
                    subgraph 基本类型
                        C[原始值: 10] --> D[拷贝值: 10]
                    end
                    subgraph 对象引用
                        E[原始引用] -->|指向| F[堆对象]
                        G[拷贝引用] -->|指向| F[堆对象]
                    end
            </div>
            
            <div class="bg-indigo-50 border-l-4 border-indigo-500 p-6 rounded-r-lg">
                <div class="flex items-start">
                    <div class="text-indigo-500 mr-4 text-xl">
                        <i class="fas fa-brain"></i>
                    </div>
                    <div>
                        <h4 class="font-bold text-gray-800 mb-2">内存模型图解</h4>
                        <p class="text-gray-700">上图展示了Java参数传递在内存中的表现。对于基本类型，传递的是值的拷贝；对于对象，传递的是引用的拷贝，两个引用指向同一个堆对象。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Impact and Practice Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <span class="text-4xl text-indigo-500 font-bold mr-4">04</span>
                <h2 class="section-title text-3xl font-bold text-gray-800">影响和实践</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-8">
                <div>
                    <h3 class="text-xl font-semibold mb-4 text-gray-800">对基本类型的影响</h3>
                    <p class="text-gray-700 mb-6">方法内部的变化不会影响外部变量。</p>
                </div>
                <div>
                    <h3 class="text-xl font-semibold mb-4 text-gray-800">对对象的影响</h3>
                    <p class="text-gray-700 mb-6">可以改变对象的状态，但不能改变对象的引用指向。这使得Java在设计上鼓励使用不可变对象（如<code class="bg-gray-100 px-1 py-0.5 rounded">String</code>）来避免意外的状态变化。</p>
                </div>
            </div>
            
            <h3 class="text-xl font-semibold mb-4 text-gray-800">完整示例</h3>
            <div class="code-block mb-6">
                <div class="code-header">
                    <i class="fab fa-java mr-2"></i>Java 完整示例
                </div>
                <div class="code-body">
                    <pre class="overflow-x-auto"><code>public static void main(String[] args) {
    int i = 10;
    add(i);
    System.out.println("i = " + i);

    System.out.println("========================");
    Map<String, String> map = new HashMap<>();
    map.put("name", "toString");
    add2(map);
    System.out.println(map);

    System.out.println("+========================");
    String str1 = "hello"; 
    test2(str1);
    System.out.println("str:" + str1);
}

private static void test2(String str2) {
    str2 = "123";
    System.out.println(str2);
}

public static void add2(Map<String, String> map2) {
    map2.put("name", "admin");
    map2.put("age", "20");
}

public static void add(int a) {
    a = 100;
}</code></pre>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mt-8">
                <div class="bg-white p-6 rounded-lg shadow-md">
                    <h4 class="font-bold text-lg mb-4 text-gray-800">基本类型传递图示</h4>
                    <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1637546215372-535cd5bf-4df1-4158-aa38-213821e241ab.png" alt="基本类型传递图示" class="w-full rounded-md">
                </div>
                <div class="bg-white p-6 rounded-lg shadow-md">
                    <h4 class="font-bold text-lg mb-4 text-gray-800">对象引用传递图示</h4>
                    <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1637546222836-96125e7c-f368-48ec-ab5e-e5d7ef8fdc7e.png" alt="对象引用传递图示" class="w-full rounded-md">
                </div>
                <div class="md:col-span-2 bg-white p-6 rounded-lg shadow-md">
                    <h4 class="font-bold text-lg mb-4 text-gray-800">字符串传递特殊图示</h4>
                    <img src="https://cdn.nlark.com/yuque/0/2022/png/21449790/1648776947152-a7202bc5-58c3-4f03-9146-0f0031ba3dd3.png" alt="字符串传递特殊图示" class="w-full rounded-md">
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="footer py-8 px-4">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-lg font-medium">技术小馆</h3>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="hover:text-indigo-300 transition-colors">
                        <i class="fas fa-globe mr-2"></i>http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```